/*
 *******************************************************************
 *@date:	2013/05/26
 *@file:	ReaderWriter
 *@author:	kushinn
 *@email:   lf.kushinn@gmail.com
 *@promise: 
 *@purpose:	
 *******************************************************************
 */
#ifndef __READER_WRITER_H__
#define __READER_WRITER_H__
#include <string>
namespace Nezha
{
	class Result{
	public:
		enum ResultStatus {
			kNotUsed,
			kErrorInReadingFile,
			kErrorInWritingFile,
			kNotImplemented,
			kFileNotHandled,
			kFileNotFound,
			kFileLoaded,
			kFileSaved,
			kFileLoadedFromCache,
			kFileRequested,
			kFileChecked,
		};
	public:
		Result(ResultStatus status, const std::string& resultStr = "") {}
		~Result(){}

	public:
		const std::string& getResultMsg(void) const { return mResultStr; }
		ResultStatus getResultStatus(void) const { return mStatus; }

		void setResultStatus(const ResultStatus status, const std::string& msg = "") 
		{ 
			mStatus = status; 
			mResultStr = msg; 
		}

	private:
		std::string mResultStr;
		ResultStatus mStatus;
	};

	class Options
	{
	public:

	};

	//[abstract]
	struct ReaderWriter
	{
		virtual Result& readFile(const std::string& filename, const Options* support) = 0;
		virtual Result& writeFile(const std::string& filename, const Options* support) = 0;
	};

}

#endif // READERWRITER_H__